package com.sorhis.controller;

import com.sorhis.dto.SysUserDTO;
import com.sorhis.service.ISysUserService;
import com.sorhis.vo.ResultVO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 账号表 前端控制器
 * </p>
 *
 * @author xihao.ding
 * @since 2025-02-08
 */
@RestController
@RequestMapping("/sysUser/v1")
@RequiredArgsConstructor
public class SysUserController {

    private final ISysUserService sysUserService;

    @GetMapping(value = "/list")
    public ResultVO search(SysUserDTO sysUserDTO) {
        return ResultVO.ok(sysUserService.findPageList(sysUserDTO));
    }

    @PostMapping(value = "/save")
    public ResultVO saveOrUpateUser(@RequestBody SysUserDTO sysUserDTO) {
        return ResultVO.ok(sysUserService.saveOrUpateDomain(sysUserDTO));
    }

    @PostMapping(value = "/del/{id}")
    public ResultVO del(@PathVariable String id) {
        return ResultVO.ok(sysUserService.del(id));
    }


}
